package be.kdg.netpresentclient;

import javax.swing.*;
import java.awt.*;

/**
 * This class makes a panel that shows the slides.
 *
 * @autor Timothy Huber, Joris Clevenbergs, Rik verschuren, Wim Van der Wilt
 */
public class ImagePanel extends JPanel {
	private static final long serialVersionUID = 1L;

	private Image image = null;
	/**
	* Constructor for initializing the Panel;
	*/
	public ImagePanel() {
		this.image = null;
		setLayout(null);
	}
	
	/**
	* Updates the image of of the panel
	*
	* @param image  ImageIcon to display. Loads the ImageIcon and repaints the panel.
	*/
	public void updateImage(ImageIcon image) {
		this.image = image.getImage();
		repaint();
	}
	
	/**
	* Paints the component.
	*
	* @param g  graphics to display;
	*/
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		g.drawImage(image, 0, 0, this);
	}
}
